package com.code.monitor.controller;

import com.alibaba.fastjson2.JSON;
import com.code.monitor.annotation.ControllerAdvice;
import com.code.monitor.annotation.ExceptionHandler;
import com.code.monitor.constants.ResultCode;
import com.code.monitor.constants.ResultEntity;

/**
 * @author ggh
 * @date 2023/5/8
 */
@ControllerAdvice
public class ExceptionController {

    @ExceptionHandler(Exception.class)
    public String exception(Exception e) {
        ResultEntity resultEntity = ResultEntity.fail(ResultCode.ERROR);
        return JSON.toJSONString(resultEntity);
    }
}
